package com.meet.controller;

import com.meet.api.dto.request.MeetInterestTagUpdateRequestDTO;
import com.meet.api.dto.request.MeetUserUpdateRequestDTO;
import com.meet.api.dto.response.MeetInterestTagListResponseDTO;
import com.meet.api.dto.response.MeetUserResponseDTO;
import com.meet.bizservice.UserBizService;
import com.meet.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
public class MeetUserController {

    @Resource
    private UserBizService userBizService;

    @GetMapping("/users/profile")
    public Result<MeetUserResponseDTO> getProfile() {

        return userBizService.getProfile();
    }

    @PutMapping("/users/profile")
    public Result<?> updateProfile(@RequestBody @Validated MeetUserUpdateRequestDTO request) {

        return userBizService.updateProfile(request.getNickname(), request.getAvatarUrl(), request.getInterestTags());
    }

    @GetMapping("/users/interest-tags")
    public Result<MeetInterestTagListResponseDTO> getInterestTags() {

        return userBizService.getInterestTags();
    }

    @PutMapping("/users/interest-tags")
    public Result<?> updateInterestTags(@RequestBody @Validated MeetInterestTagUpdateRequestDTO request) {

        return userBizService.updateInterestTags(request.getInterestTags());
    }

}
